﻿using UnityEngine;
using TinyWnd;

public class MatchingWnd : Wnd
{
    GameObject goBtnWin;
    GameObject goBtnLose;
    GameObject goBtnShop;

    protected override void OnAwake()
    {
        _wndId = WndId.matching;
        _hideOtherWnd = true;

        var tran = transform;
        goBtnWin = Utility.FindChild(tran, "Right/BtnWin").gameObject;
        goBtnLose = Utility.FindChild(tran, "Right/BtnLose").gameObject;
        goBtnShop = Utility.FindChild(tran, "Right/BtnShop").gameObject;

        var inst = WndMgr.inst;
        UIEventListener.Get(goBtnWin).onClick = delegate
        {
            Close(false);
            var content = new MatchResultContent();
            content.isWin = true;
            inst.ShowWindow(WndId.matchResult, content);
        };

        UIEventListener.Get(goBtnLose).onClick = delegate
        {
            Close(false);
            var content = new MatchResultContent();
            content.isWin= false;
            inst.ShowWindow(WndId.matchResult, content);
        };

        UIEventListener.Get(goBtnShop).onClick = delegate
        {
            inst.ShowWindow(WndId.shop);
        };
    }
}
